package jeons.common.util.mail;




import jeons.common.util.SimpleMailService;

import jeons.member.dto.MemberDTO;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("email")
public class MailController {
	private SimpleMailService simpleMail;

	 

	 public void setSimpleMail(SimpleMailService simpleMail) {
	  this.simpleMail = simpleMail;
	 }
	 
	 @RequestMapping(value="/send", method=RequestMethod.GET)
	 public @ResponseBody String send( ){
		 String check = "true";	 
	 /* boolean result = simpleMail.sendMail(username, userpassword, useremail);*/
	  /*System.out.println(result);*/
	  return check;
	  
	 }
	 
 	/**
 	* @Method Name  : test
 	* @작성일   : 2012. 2. 23.
 	* @작성자   : user
 	* @변경이력  :
 	* @Method 설명 : 메일보내기
 	* @param memberDTO
 	* @return
 	*/
 	@RequestMapping(value="/Sendemail", method=RequestMethod.POST)
	public @ResponseBody String test(@ModelAttribute("memberSendEmail")MemberDTO memberDTO){
 		System.out.println(memberDTO.getUsername());
 		System.out.println(memberDTO.getUserpassword());
 		System.out.println(memberDTO.getUseremail());
		simpleMail.sendMail(memberDTO.getUsername(), memberDTO.getUserpassword(), memberDTO.getTempemail());
		/*String check = "true";
		if (!result) {
			check = "false";
		}*/
		return "check";
	}
}
